<?php
class Program extends AppModel {
	var $name = 'Program';
	var $displayField = 'what';
	var $validate = array(
		'what' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'WHAT cannot be left empty',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'why' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'WHY cannot be left empty',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'when_start' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'Start Date cannot be left empty',
				//'allowEmpty' => false,
				//'required' => false,
				'last' => true, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
			'date' => array(
				'rule' => array('date','ymd'),
				'message' => 'Invalid Date format(yyyy-mm-dd)',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'when_end' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'End Date cannot be left empty',
				//'allowEmpty' => false,
				//'required' => false,
				'last' => true, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
			'date' => array(
				'rule' => array('date','ymd'),
				'message' => 'Invalid Date format(yyyy-mm-dd)',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'focus_area_id' => array(                   
			'multiple' => array(
				'rule' => array('multiple', array('in' => array('2', '3', '4', '5', '6', '7', '8'), 'min' => 1, 'max' => 3)),
                                'required' => true,
				'message' => 'You have to select at least one but not more than three focus areas.',
				'allowEmpty' => false,				
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			)
                    )
	);
	//The Associations below have been created with all possible keys, those that are not needed can be removed

	var $belongsTo = array(
		'User' => array(
			'className' => 'User',
			'foreignKey' => 'user_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);

	var $hasMany = array(
		'Enroll' => array(
			'className' => 'Enroll',
			'foreignKey' => 'program_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),'FocusProgram' => array(
			'className' => 'FocusProgram',
			'foreignKey' => 'program_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''		
		),
		'Will' => array(
			'className' => 'Will',
			'foreignKey' => 'program_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);
       
}
